package com.csust.cg.mongodb.config;

import com.csust.cg.mongodb.inteceptor.AuthInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chenguang
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 不放行路径
        List<String> patterns = new ArrayList<>();
        patterns.add("/api/group/**");
        patterns.add("/api/save_connect/**");
        patterns.add("/api/recent_connect/**");
        registry.addInterceptor(new AuthInterceptor()).addPathPatterns(patterns);
    }
}
